import os
import pandas as pd


raw_path = "D:\daily work\ml\\raw"


def xgb_prepare_data():
    files = os.listdir(raw_path)
    all_train = []
    for file_name in files:
        sec_id, _ = file_name.split("_")
        df = pd.read_csv(f"{raw_path}\\{file_name}")

        df["datetime"] = pd.to_datetime(df["datetime"])
        df.set_index("datetime", inplace=True)
        df["sec_id"] = sec_id

        all_train.append(df)

    train_df = pd.concat(all_train)
    train_df.sort_index(inplace=True)
    return train_df
